package com.bubblegumproject.ogo.remote.io;

import com.bubblegumproject.ogo.action.ActionErrorStack;
import com.bubblegumproject.ogo.action.Source;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Packet containing Action data that can be easily serialized.
 *
 * XXX: What about the Action's other properties? Source and Error stack have to be transmitted
 *
 * @author Azubuko Obele (buko.obele@gmail.com)
 */
public class ActionPacket implements Serializable {

    private String actionClassName;

    private Source actionSource;

    private ActionErrorStack actionErrorStack;

    private Map<String, Object> properties = new HashMap<String, Object>();


    public String getActionClassName() {
        return actionClassName;
    }

    public void setActionClassName(String actionClassName) {
        this.actionClassName = actionClassName;
    }

    public Source getActionSource() {
        return actionSource;
    }

    public void setActionSource(Source actionSource) {
        this.actionSource = actionSource;
    }

    public ActionErrorStack getActionErrorStack() {
        return actionErrorStack;
    }

    public void setActionErrorStack(ActionErrorStack actionErrorStack) {
        this.actionErrorStack = actionErrorStack;
    }

    public Object get(String property) {
        return properties.get(property);
    }

    public void set(String property, Object value) {
        properties.put(property, value);
    }

    public String toString() {
        return "[" + getClass().getSimpleName() + " actionClassName=" + actionClassName +
                " properties=" + properties + "]";
    }
}
